def singleton(cls):
    """Decorator intended to decorate a class instead of a method/function.

    Use this decorator to turn any class into a singleton.  For more
    information on singletons, see:
        http://en.wikipedia.org/wiki/Singleton_pattern
    """
    instances = {}

    def get_instance():
        if cls not in instances:
            instances[cls] = cls()
        return instances[cls]
    return get_instance
